﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once

#include "RpcSharedObject.h"
#include "UniIdentity.h"
#include "OwnerPtr.h"
#include "Matrix4d.h"
#include "Vector3d.h"

namespace gcmp
{
    // 编辑族共享数据
    class GM_INPLACE_EDIT_EXPORT EditFamilySharedContent : public RpcSharedObject
    {
        DBOBJECT_DATA_BEGIN(gcmp, EditFamilySharedContent, gcmp::RpcSharedObject, A49A6F25 - 9E68 - 48C2 - B4F0 - D7DFAC91FEB3, gminplaceedit)
            DATA(std::wstring, MainServiceGuid)
            DATA(std::wstring, MainDocumentPath)
            DATA(std::wstring, EditFamilyFilePath)
            DATA(std::wstring, FamilyName)
        DBOBJECT_DATA_END

    public:
        const std::wstring& GetMainServiceGuid() const { return this->GetMainServiceGuid__(); }
        bool SetMainServiceGuid(const std::wstring& connectionGuid) { this->SetMainServiceGuid__(connectionGuid); return true; }
        const std::wstring& GetMainDocumentPath() const { return this->GetMainDocumentPath__(); }
        bool SetMainDocumentPath(const std::wstring& mainDocumentPath) { this->SetMainDocumentPath__(mainDocumentPath); return true; }
        const std::wstring& GetEditFamilyFilePath() const { return this->GetEditFamilyFilePath__(); }
        bool SetEditFamilyFilePath(const std::wstring& familyFilePath) { this->SetEditFamilyFilePath__(familyFilePath); return true; }
        const std::wstring& GetFamilyName() const { return this->GetFamilyName__(); }
        bool SetFamilyName(const std::wstring& familyName) { this->SetFamilyName__(familyName); return true; }

    };

    // 编辑族共享数据
    class GM_INPLACE_EDIT_EXPORT LoadFamilyToProjectSharedContent : public RpcSharedObject
    {
        DBOBJECT_DATA_BEGIN(gcmp, LoadFamilyToProjectSharedContent, gcmp::RpcSharedObject, DDB63CEE - 12FA - 4FB3 - A317 - 0B7F8E4E6FA7, gminplaceedit)
            DATA(std::wstring, MainServiceGuid)
            DATA(std::wstring, FamilyServiceGuid)
            DATA(UInt16, RequestPort)
            MAP_DATA(std::wstring, std::wstring, MainDocumentPathToNameMap)
            DATA(Bool, IsCloseFamilyDocument)
        DBOBJECT_DATA_END

    public:
        const std::wstring& GetMainServiceGuid() const { return this->GetMainServiceGuid__(); }
        bool SetMainServiceGuid(const std::wstring& connectionGuid) { this->SetMainServiceGuid__(connectionGuid); return true; }
        const std::wstring& GetFamilyServiceGuid() const { return this->GetFamilyServiceGuid__(); }
        bool SetFamilyServiceGuid(const std::wstring& connectionGuid) { this->SetFamilyServiceGuid__(connectionGuid); return true; }
        const bool GetIsCloseFamilyDocument() const { return this->GetIsCloseFamilyDocument__(); }
        bool SetIsCloseFamilyDocument(bool isCloseFamilyDocument) { this->SetIsCloseFamilyDocument__(isCloseFamilyDocument); return true; }

        UInt16 GetRequestPort() const { return this->GetRequestPort__(); }
        bool SetRequestPort(UInt16 requestPort) { this->SetRequestPort__(requestPort); return true; }
        const std::map<std::wstring, std::wstring>& GetMainDocumentPathToNameMap() const { return this->GetMainDocumentPathToNameMap__(); }
        bool AddMainDocumentPathToNameMap(const std::wstring& mainDocumentPath, const std::wstring& documentName);
        void ClearMainDocumentPathToNameMap();
    };

    // 编辑族共享脚本数据
    class GM_INPLACE_EDIT_EXPORT EditFamilySharedJournalContent : public RpcSharedObject
    {
        CANNOT_COPY_OR_ASSIGN(EditFamilySharedJournalContent)
            DBOBJECT_DATA_BEGIN(gcmp, EditFamilySharedJournalContent, gcmp::RpcSharedObject, 331AE4B1 - D209 - 4F53 - 93E5 - 95FC2A8218FA, gminplaceedit)
            MAP_DATA(std::wstring, std::wstring, JournalMessage)// element 可见性过滤器
            DBOBJECT_DATA_END

    public:
        const std::map<std::wstring, std::wstring>& GetJournalMessage() const
        {
            return this->GetJournalMessage__();
        }

        bool SetJournalMessage(const std::map<std::wstring, std::wstring>& message)
        {
            this->SetJournalMessage__(message); return true;
        }
    };

}// namespace gcmp
